/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package login.business;

import java.sql.Connection;
import java.sql.SQLException;
import javax.faces.context.FacesContext;
import login.DAO.LoginDAO;
import login.bean.LoginBean;

/**
 *
 * @author Javier
 */
public class LoginBusiness {

    public Connection conn;
    String user;
    String password;
    String host;
    String database;
    String port;
    private LoginBean lb ;
    
    public LoginBusiness() {
        lb = (LoginBean) FacesContext.getCurrentInstance()
                .getExternalContext().getSessionMap().get("loginBean");
        this.conn = lb.getCurrentConnection();
    }

    public LoginBusiness(String user, String password, String host, String port) {
        this.user = user;
        this.password = password;
        this.host = host;
        this.port = port;
    }

    public Connection login() throws SQLException {
        
        LoginDAO loginDAO = new LoginDAO();
        return loginDAO.login(user, password, host, port);

    }
}
